<template>
	<van-cell @click="handleClick">
		<slot v-if="hasSlot('default')" name="default"></slot>
		<template v-if="!hasSlot('default')" #title>
			<span>{{ item.srfmajortext }}</span>
		</template>
		<template #right-icon>
			<template v-if="singleSelect">
				<van-checkbox v-model="isSelect" :name="item" @click.stop />
			</template>
			<template v-else>
				<van-checkbox :checked="isSelect" shape="square"></van-checkbox>
			</template>
		</template>
	</van-cell>
</template>
<script setup lang="ts">
import { MDCtrlItemProps } from '../md-ctrl';

const emit = defineEmits<{
	(name: 'item-action-click', logic: any, $event: any): void;
	(name: 'item-click', $event: any): void;
}>();
const props = defineProps(MDCtrlItemProps);

const handleClick = ($event: any) => {
	emit('item-click', $event);
};
const hasSlot = (name: string): boolean => {
	return !!useSlots()[name];
};
</script>
